package com.example.demo.jvm;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author cc
 *
 * @description
 *
 * @date 2021年05月11 18:05
 *
 *
 */
public class Test {

    public static void main(String[] args) throws Exception {
        List<Data> datas = new ArrayList<Data>();
        for (int i = 0; i < 10000; i++) {
            datas.add(new Data());
        }
        Thread.sleep(1 * 60 * 60 * 1000);
    }

    static class Data {

    }


    //模拟jstat jmap jhet
    private static void loadData() throws Exception {
        byte[] data = null;
        for (int i = 0; i < 50; i++) {
            data = new byte[100 * 1024];
        }
        data = null;
        Thread.sleep(1000);
    }


    //模拟young GC
    public void YoungGC(String[] args) {
        byte[] array1 = new byte[1024 * 1024];
        array1 = new byte[1024 * 1024];
        array1 = new byte[1024 * 1024];
        array1 = null;
        byte[] array2 = new byte[1024 * 1024];
    }
}